﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebService_Newstore.DAO
{
    /// <summary>
    /// NE SERT A RIEN POUR L'INSTANT
    /// </summary>
    public class ConfidentialitesDAO:BaseDAO
    {
        public int idConf { get; set; }
        public string libConf { get; set; }

        public ConfidentialitesDAO(int idConf)
        {
            using (newStoreContext = new newStoreEntities())
            {
                try
                {
                    var confQuery = from confidentialite in newStoreContext.confidentialites
                                    where confidentialite.id_conf == idConf
                                    select confidentialite;

                    if (confQuery.LongCount() == 0)
                        throw new Exception("Pas de conf pour cet id !!");

                    foreach (var conf in confQuery)
                    {
                        this.idConf = idConf;
                        this.libConf = conf.lib_conf;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadLine();
                }
            }
        }
    }
}